package com.bestsoft.web.controller.flow;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bestsoft.common.annotation.Log;
import com.bestsoft.common.core.controller.BaseController;
import com.bestsoft.common.core.domain.AjaxResult;
import com.bestsoft.common.enums.BusinessType;
import com.bestsoft.system.domain.FlowPiclist;
import com.bestsoft.system.service.IFlowPiclistService;
import com.bestsoft.common.utils.poi.ExcelUtil;
import com.bestsoft.common.core.page.TableDataInfo;

/**
 * 图片管理单Controller
 * 
 * @author wang
 * @date 2023-08-03
 */
@RestController
@RequestMapping("/flow/piclist")
public class FlowPiclistController extends BaseController
{
    @Autowired
    private IFlowPiclistService flowPiclistService;

    /**
     * 查询图片管理单列表
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:list')")
    @GetMapping("/list")
    public TableDataInfo list(FlowPiclist flowPiclist)
    {
        startPage();
        List<FlowPiclist> list = flowPiclistService.selectFlowPiclistList(flowPiclist);
        return getDataTable(list);
    }

    /**
     * 导出图片管理单列表
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:export')")
    @Log(title = "图片管理单", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, FlowPiclist flowPiclist)
    {
        List<FlowPiclist> list = flowPiclistService.selectFlowPiclistList(flowPiclist);
        ExcelUtil<FlowPiclist> util = new ExcelUtil<FlowPiclist>(FlowPiclist.class);
        util.exportExcel(response, list, "图片管理单数据");
    }

    /**
     * 获取图片管理单详细信息
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:query')")
    @GetMapping(value = "/{picClassName}")
    public AjaxResult getInfo(@PathVariable("picClassName") String picClassName)
    {
        return success(flowPiclistService.selectFlowPiclistByPicClassName(picClassName));
    }

    /**
     * 新增图片管理单
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:add')")
    @Log(title = "图片管理单", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody FlowPiclist flowPiclist)
    {
        return toAjax(flowPiclistService.insertFlowPiclist(flowPiclist));
    }

    /**
     * 修改图片管理单
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:edit')")
    @Log(title = "图片管理单", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody FlowPiclist flowPiclist)
    {
        return toAjax(flowPiclistService.updateFlowPiclist(flowPiclist));
    }

    /**
     * 删除图片管理单
     */
    @PreAuthorize("@ss.hasPermi('flow:piclist:remove')")
    @Log(title = "图片管理单", businessType = BusinessType.DELETE)
	@DeleteMapping("/{picClassNames}")
    public AjaxResult remove(@PathVariable String[] picClassNames)
    {
        return toAjax(flowPiclistService.deleteFlowPiclistByPicClassNames(picClassNames));
    }
}
